package com.spring.redis.operation.utils;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * redis操作相关工具类
 *
 * @author zhouyu
 */
public class RedisOperationUtils {

    /**
     * List<Object>转List<String>
     *
     * @param objects objects
     * @return java.util.List<String>
     */
    public static List<String> listObjectCastString(List<Object> objects) {
        if (null == objects) {
            return null;
        }
        return objects.stream().map(String::valueOf).collect(Collectors.toList());
    }

    /**
     * 数组去重转集合
     *
     * @param keys keys
     * @return java.util.Set
     */
    public static Set<String> arrToSet(String... keys) {
        return Stream.of(keys).collect(Collectors.toSet());
    }

}
